<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
		<link rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/css/weuix.min.css" />
		<title>我的电子照</title>
		  <link rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/css/weui.css"/>
  	<link rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/css/weui2.css"/>
  	<link rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/css/weui3.css"/>
      <script src="{:ADDON_PUBLIC_PATH}/js/zepto.min.js"></script>
      <script src="{:ADDON_PUBLIC_PATH}/js/swipe.js"></script>
      <script>
      function onBridgeReady() { 
    	    WeixinJSBridge.call('hideOptionMenu'); 
    	} 
    	 
    	if (typeof WeixinJSBridge == "undefined") { 
    	    if (document.addEventListener) { 
    	        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false); 
    	    } else if (document.attachEvent) { 
    	        document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
    	        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady); 
    	    } 
    	} else { 
    	    onBridgeReady(); 
    	}
  $(function(){
$('#slide1').swipeSlide({
autoSwipe:true,//自动切换默认是
speed:3000,//速度默认4000
continuousScroll:true,//默认否
transitionType:'cubic-bezier(0.22, 0.69, 0.72, 0.88)',//过渡动画linear/ease/ease-in/ease-out/ease-in-out/cubic-bezier
lazyLoad:true,//懒加载默认否
firstCallback : function(i,sum,me){
            me.find('.dot').children().first().addClass('cur');
        },
        callback : function(i,sum,me){
            me.find('.dot').children().eq(i).addClass('cur').siblings().removeClass('cur');
        }
});

	  
	  });    
      
      </script>
	</head>

	<body>  
<div class="slide" id="slide1">
    <ul>
        <li>
            <a href="#">
                <img src="" data-src="{:ADDON_PUBLIC_PATH}/images/print1.png" alt="">
            </a>
            <div class="slide-desc">拍出最美的自己</div>
        </li>
        <li>
            <a href="#">
                <img src="" data-src="{:ADDON_PUBLIC_PATH}/images/print2.png" alt="">
            </a>
            <div class="slide-desc">出最美的自己</div>
        </li>
        <li>
            <a href="#">
                <img src="" data-src="{:ADDON_PUBLIC_PATH}/images/print3.png" alt="">
            </a>
            <div class="slide-desc">出最美的自己</div>
        </li>
    </ul>
    <div class="dot">
        <span></span>
        <span></span>
        <span></span>
    </div>
</div>

  		
        <form action="">
        	<input type="hidden" id="uid" value="{:I('uid')}">
        	
        	
       <div class="page-bd">
     		<div class="weui_cells_title">选择你要打印的底色</div>
        <div class="weui_cells weui_cells_checkbox">
            <volist name="data" id="da">
            <label class="weui_cell weui_check_label" for="s{$i}">
                <div class="weui_cell_hd">
                    <input type="checkbox" class="weui_check electron" value="{$da['id']}" name="checkbox1" id="s{$i}">
                    <i class="weui_icon_checked"></i>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <img alt="" height="100" src="{$da['path']}">	
                </div>
            
            </label>
            </volist>   
       </div>
	<div class="page-bd">
	
	  <div class="weui_cells_title">尺寸</div>
        <div class="weui_cells weui_cells_radio">
            <label class="weui_cell weui_check_label" for="x11">
                <div class="weui_cell_bd weui_cell_primary">
                    <p>1寸<span>适用：档案照、社团照、比赛、简历，9张</span></p>
                </div>
                <div class="weui_cell_ft">
                    <input type="radio" value="1寸" class="weui_check size" name="size" id="x11">
                    <span class="weui_icon_checked"></span>
                </div>
            </label>
            <label class="weui_cell weui_check_label" for="x12">

                <div class="weui_cell_bd weui_cell_primary">
                    <p>小1寸<span>适用：驾照报名照，9张</span></p>
                </div>
                <div class="weui_cell_ft">
                    <input type="radio" value="小1寸" class="weui_check size" name="size" id="x12">
                    <span class="weui_icon_checked"></span>
                </div>
            </label>
             <label class="weui_cell weui_check_label" for="x13">

                <div class="weui_cell_bd weui_cell_primary">
                    <p>2寸<span>适用：通行证，4张</span></p>
                </div>
                <div class="weui_cell_ft">
                    <input type="radio" value="2寸" class="weui_check size" name="size" id="x13">
                    <span class="weui_icon_checked"></span>
                </div>
            </label>
             <label class="weui_cell weui_check_label" for="x14">

                <div class="weui_cell_bd weui_cell_primary">
                    <p>小2寸<span>适用：职业考试证照，4张</span></p>
                </div>
                <div class="weui_cell_ft">
                    <input type="radio" value="小2寸" class="weui_check size" name="size" id="x14">
                    <span class="weui_icon_checked"></span>
                </div>
            </label>
           
        </div>
	
	
      <div class="weui_cells_title">提取方式</div>
        <div class="weui_cells weui_cells_radio">
            <label class="weui_cell weui_check_label" for="x15">
                <div class="weui_cell_bd weui_cell_primary">
                    <p>自提:(西区创业园B5工作室)</p>
                </div>
                <div class="weui_cell_ft">
                    <input type="radio" value="1" class="weui_check extract" name="extract" id="x15" checked="checked">
                    <span class="weui_icon_checked"></span>
                </div>
            </label>
            <label class="weui_cell weui_check_label" for="x16">

                <div class="weui_cell_bd weui_cell_primary">
                    <p>送货上门</p>
                </div>
                <div class="weui_cell_ft">
                    <input type="radio" value="2"  class="weui_check extract" name="extract" id="x16">
                    <span class="weui_icon_checked"></span>
                </div>
            </label>
           
        </div>

       </div>
       <div class="weui_cells weui_cells_form">
        	<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">费用</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" id="price" type="number" value="9.9" disabled="disabled"/>
                </div>
            </div>
        </div>
			
			<div class="weui_cells_title">备注</div>     
		 <div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="remark" class="weui_textarea" placeholder="请输入备注或者收货地址" rows="3"></textarea>
                    <div class="weui_textarea_counter"><span id='count'>0</span>/<span id='count_max'>50</span></div>
                </div>
            </div>
        </div>
		
		<label for="weuiAgree" class="weui-agree">
            <input id="weuiAgree" class="weui-agree-checkbox" type="checkbox">
            <span class="weui-agree-text">
                阅读并同意<a href="{:U('term_text_cn')}">《相关条款》</a>
            </span>
        </label>
        	
		<div class="weui_btn_area">
            <a class="weui_btn weui_btn_primary" id="btn">确定</a>
        </div>
        
        </form>
       <div align="center">
        <img src="{:ADDON_PUBLIC_PATH}/images/1068784859.jpg" class="img-border img-max" style="width: 82%; height: 82%; padding: 20px;">
        <br />
         <img src="{:ADDON_PUBLIC_PATH}/images/1068784867.jpg" class="img-border img-max" style="width: 95%; height: 95%;">
         <br />
          <img src="{:ADDON_PUBLIC_PATH}/images/1068784860.jpg" class="img-border img-max" style="width: 95%; height: 95%;">
          <br />
           <img src="{:ADDON_PUBLIC_PATH}/images/1068784865.jpg" class="img-border img-max" style="width: 95%; height: 95%;">
 		</div>
       <div class="weui-footer" style="margin-top: 60px;">
          <p class="weui-footer__links">
            <a href="http://h.eqxiu.com/s/04twlh4V" class="weui-footer__link">微生活工作室</a>|  <a href="{:U('infoReview')}" class="weui-footer__link">意见反馈</a>
          </p>
          <a  href="{:U('term_text_cn')}" class="weui-footer__text" style="border-radius: ;">Copyright © 20016-2017</a>
        </div>
	</body>
	<script type="text/javascript">
	
	 $(function(){
	   var max = $('#count_max').text();
	   $('#remark').on('input', function(){
	      var text = $(this).val();
	      var len = text.length;   
	      $('#count').text(len);    
	      if(len > max){
	        $(this).closest('.weui_cell').addClass('weui_cell_warn');
	      }
	      else{
	        $(this).closest('.weui_cell').removeClass('weui_cell_warn');
	      }     
	   });
	 })      
		// $('#touxiang').zoomify();
	 	$(document).on('change','.extract',function(){
	 		//提货方式
			   var extract = "";
			   $('.extract').each(function() {
			        if ($(this).prop('checked') ==true) {
			        	extract=$(this).val();      
			        	if(extract == 1)
			        	{
			        		
			        		$('#price').val("9.9");	
			        	}
			        	else
			        	{
			        		$('#price').val("12");	
			        	}
			        }
				});
			   
	 	});
       
		 $("#btn").click(function(){
			//复选框
			var electron_id=""; 
			$('.electron').each(function() {
		        if ($(this).prop('checked') ==true) {
		        	electron_id+=$(this).val()+",";      
		        }
			});
			
		   if(electron_id.length == 0)
		   {
			   $.toast('请选择要打印的相片', "forbidden");
			   return false;
		   }
		   //单选框
		   var size = "";
		   $('.size').each(function() {
		        if ($(this).prop('checked') ==true) {
		        	size=$(this).val();      
		        }
			});
		   
		   if(size.length == 0)
		   {
			  $.toast('请选择要打印的相片的尺寸', "forbidden");
			  return false;
		   }
		   var remark = $('#remark').val();
		   if(remark.length <5)
		   {
			   $.toast('请输入备注或者收货地址,不要少于5个字', "forbidden");
			   return false;
		   }
		   if($('#weuiAgree').prop('checked') != true)
		   {
			   $.toast('请先阅读并同意', "forbidden");
			   return false;
		   }
		   var url = "{:U('electron_pic')}";
		   var photo_id = $('#uid').val();
		   var price　= $('#price').val();
		   $.ajax({
			    url:url,
			    type:"post",
			    dataType:"json",
			    data:{"size":size,"photo_id":photo_id,"electron_id":electron_id,"remark":remark,'price':price},
			    success:function(data){
			     	
		            console.log(data);
		            if (data.status == 1) {
		                 $.toast(data.info); 
		                 setTimeout(function(){
		                 	
		                 	location.href = "{:U('photo_print')}";
		                 	
		                 },1500);
		            } else {
		                 $.toast(data.info, "forbidden");
		            }
			    },
			    error:function(){
			      	$.toast("错误", "forbidden");
			    }
		   });
		})
	</script>
</html>